/*
 * @Date: 2022-06-14 14:52:49
 * @LastEditors: 春贰
 * @gitee: https://gitee.com/chun22222222
 * @github: https://github.com/chun222
 * @Desc:
 * @LastEditTime: 2022-12-26 16:04:01
 * @FilePath: \server\system\util\numberUtil\numberUtil.go
 */
package numberUtil

import (
	"math"
	"strconv"

	"go-easy-dashboard/system/util/convert"
)

//保留n位小数
func RoundFloat(value float64, dig int) float64 {

	result, _ := convert.Float(strconv.FormatFloat(value, 'f', dig+1, 64))
	pow := math.Pow(10, float64(dig))
	return math.Round(result*pow) / pow

}
